/*
 * Copyright (c) Huawei Technologies Co., Ltd. 2022-2022. All rights reserved.
 *
 */

import { DefaultTask, Project } from '@ohos/hvigor';

import { CommonConst } from '../../../const/common-const.js';
import { TaskNames } from '../../common/task-names.js';
import { ProjectTaskService } from '../../service/project-task-service.js';
import { SignApp } from '../../sign-app.js';

import CommonHookTask = TaskNames.CommonHookTask;

/**
 * 组装打包app的任务流
 *
 * @since 2022/1/20
 */
export class AssembleApp extends DefaultTask {
  private readonly _taskService: ProjectTaskService | undefined;

  constructor(project: Project, taskService: ProjectTaskService) {
    super(project, CommonHookTask.ASSEMBLE_APP);
    this._taskService = taskService;
    this.initTaskDepends();
    this.getWorkerPool().warmUp(CommonConst.WARM_UP_SCRIPT);
  }

  private initTaskDepends() {
    this.dependsOn(SignApp.name);
  }

  registryAction = () => {
    return () => {
      // This is a hook task,it do nothing
    };
  };
}
